<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<script src="http://code.jquery.com/jquery-latest.js"></script>
		<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.12.0.css" type="text/css" media="screen" />
		<script type="text/javascript" src="http://code.jquery.com/qunit/qunit-1.12.0.js"></script>
		<script type="text/javascript" src="../build/astrochart.js"></script>	
		
		<script>			
			window.onload = function( ) {							
				test( "getSign", function( ) {
					
					var cusps = [296, 350, 30, 56, 75, 94, 116, 170, 210, 236, 255, 274];
					var reporter = new astrology.Zodiac( cusps );
					
					equal( reporter.getSign( 0 ), 1 );						
					equal( reporter.getSign( 30 ), 2 );
					equal( reporter.getSign( 270 ), 10 );
					equal( reporter.getSign( 359 ), 12 );
					
					equal( reporter.getSign( 361 ), 1 );					
				});	
				
				test( "isRetrograde", function( ) {
					
					var cusps = [296, 350, 30, 56, 75, 94, 116, 170, 210, 236, 255, 274];
					var reporter = new astrology.Zodiac( cusps );
					
					equal( reporter.isRetrograde( -1 ), true );						
					equal( reporter.isRetrograde( 1 ), false );
									
				});
				
				test( "getHouseNumber1", function( ) {
					
					var cusps = [296.1, 350, 30, 56, 75, 94, 116, 170, 210, 236, 255, 274];
					var reporter = new astrology.Zodiac( cusps );
					
					equal( reporter.getHouseNumber( 274 ), 12 );					
					equal( reporter.getHouseNumber( 296 ), 12 );						
					
					equal( reporter.getHouseNumber( 296.1 ), 1 );
					
					equal( reporter.getHouseNumber( 350 ), 2 );
					equal( reporter.getHouseNumber( 359 ), 2 );
					equal( reporter.getHouseNumber( 0 ), 2 );
					equal( reporter.getHouseNumber( 361 ), 2 );					
					equal( reporter.getHouseNumber( 29.9 ), 2 );
					
					equal( reporter.getHouseNumber( 30 ), 3 );	
																													
				});
				
				test( "getHouseNumber2", function( ) {
					
					var cusps = [265.6850555442075,307.6441825689919,353.38796689506074,26.86890880306794,50.191811553503044,68.57049261566578,85.6850555442075,127.64418256899188,173.3879668950608,206.8689088030679,230.19181155350307,248.5704926156658];
					var reporter = new astrology.Zodiac( cusps );
					
					equal( reporter.getHouseNumber( 248.58 ), 12 );					
					equal( reporter.getHouseNumber( 265 ), 12 );						
					
					equal( reporter.getHouseNumber( 265.7 ), 1 );
					
					equal( reporter.getHouseNumber( 307.65 ), 2 );
					equal( reporter.getHouseNumber( 353.4 ), 3 );
					equal( reporter.getHouseNumber( 0 ), 3 );
					equal( reporter.getHouseNumber( 361 ), 3 );					
					
					equal( reporter.getHouseNumber( 26.87 ), 4 );																																				
				});
				
				test( "dignities - Sun", function( ) {
					
					var cusps = [0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330];
					var reporter = new astrology.Zodiac( cusps  );	
																	
					deepEqual( reporter.getDignities( {name:"Sun", position:120} ), [astrology.DIGNITIES_RULERSHIP] );
					deepEqual( reporter.getDignities( {name:"Sun", position:300} ), [astrology.DIGNITIES_DETRIMENT] );
					deepEqual( reporter.getDignities( {name:"Sun", position:150} ), [astrology.DIGNITIES_FALL] );
					deepEqual( reporter.getDignities( {name:"Sun", position:18} ), [astrology.DIGNITIES_EXALTATION] );					
					deepEqual( reporter.getDignities( {name:"Sun", position:0}, [{"name":"Sun", "position":0, "orbit":2}] ), [astrology.DIGNITIES_EXALTATION, astrology.DIGNITIES_EXACT_EXALTATION] );																																					
				});
				
				test( "dignities - Moon", function( ) {
					
					var cusps = [0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330];
					var reporter = new astrology.Zodiac( cusps  );	
																	
					deepEqual( reporter.getDignities( {name:"Moon", position:90} ), [astrology.DIGNITIES_RULERSHIP] );
					deepEqual( reporter.getDignities( {name:"Moon", position:270} ), [astrology.DIGNITIES_DETRIMENT] );
					deepEqual( reporter.getDignities( {name:"Moon", position:210} ), [astrology.DIGNITIES_FALL] );					
					deepEqual( reporter.getDignities( {name:"Moon", position:30} ), [astrology.DIGNITIES_EXALTATION] );					
					deepEqual( reporter.getDignities( {name:"Moon", position:32}, [{"name":"Moon", "position":33, "orbit":2}] ), [astrology.DIGNITIES_EXALTATION, astrology.DIGNITIES_EXACT_EXALTATION] );																																					
				});
				
				test( "dignities - Mercury", function( ) {
					
					var cusps = [0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330];
					var reporter = new astrology.Zodiac( cusps  );	
																	
					deepEqual( reporter.getDignities( {name:"Mercury", position:60} ), [astrology.DIGNITIES_RULERSHIP] );									
					deepEqual( reporter.getDignities( {name:"Mercury", position:240} ), [astrology.DIGNITIES_DETRIMENT] );
					
					deepEqual( reporter.getDignities( {name:"Mercury", position:330} ), [astrology.DIGNITIES_FALL] );					
					
					deepEqual( reporter.getDignities( {name:"Mercury", position:150} ), [astrology.DIGNITIES_EXALTATION] );										;					
					deepEqual( reporter.getDignities( {name:"Mercury", position:156}, [{"name":"Mercury", "position":155, "orbit":2}] ), [astrology.DIGNITIES_EXALTATION, astrology.DIGNITIES_EXACT_EXALTATION] );																																					
				});
				
				test( "dignities - Venus", function( ) {
					
					var cusps = [0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330];
					var reporter = new astrology.Zodiac( cusps  );	
																	
					deepEqual( reporter.getDignities( {name:"Venus", position:30} ), [astrology.DIGNITIES_RULERSHIP] );									
					deepEqual( reporter.getDignities( {name:"Venus", position:180} ), [astrology.DIGNITIES_RULERSHIP] );
					
					deepEqual( reporter.getDignities( {name:"Venus", position:0} ), [astrology.DIGNITIES_DETRIMENT] );
					deepEqual( reporter.getDignities( {name:"Venus", position:210} ), [astrology.DIGNITIES_DETRIMENT] );
					
					deepEqual( reporter.getDignities( {name:"Venus", position:150} ), [astrology.DIGNITIES_FALL] );					
					
					deepEqual( reporter.getDignities( {name:"Venus", position:330} ), [astrology.DIGNITIES_EXALTATION] );										;					
					deepEqual( reporter.getDignities( {name:"Venus", position:357.987}, [{"name":"Venus", "position":357, "orbit":2}] ), [astrology.DIGNITIES_EXALTATION, astrology.DIGNITIES_EXACT_EXALTATION] );																																					
				});
				
				test( "dignities - Mars", function( ) {
					
					var cusps = [0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330];
					var reporter = new astrology.Zodiac( cusps  );	
																	
					deepEqual( reporter.getDignities( {name:"Mars", position:0} ), [astrology.DIGNITIES_RULERSHIP] );									
					deepEqual( reporter.getDignities( {name:"Mars", position:210} ), [astrology.DIGNITIES_RULERSHIP] );
					
					deepEqual( reporter.getDignities( {name:"Mars", position:30} ), [astrology.DIGNITIES_DETRIMENT] );
					deepEqual( reporter.getDignities( {name:"Mars", position:180} ), [astrology.DIGNITIES_DETRIMENT] );
					
					deepEqual( reporter.getDignities( {name:"Mars", position:90} ), [astrology.DIGNITIES_FALL] );					
					
					deepEqual( reporter.getDignities( {name:"Mars", position:270} ), [astrology.DIGNITIES_EXALTATION] );										;					
					deepEqual( reporter.getDignities( {name:"Mars", position:298}, [{"name":"Mars", "position":298, "orbit":2}] ), [astrology.DIGNITIES_EXALTATION, astrology.DIGNITIES_EXACT_EXALTATION] );																																					
				});
				
				test( "dignities - Jupiter", function( ) {
					
					var cusps = [0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330];
					var reporter = new astrology.Zodiac( cusps  );	
																	
					deepEqual( reporter.getDignities( {name:"Jupiter", position:240} ), [astrology.DIGNITIES_RULERSHIP] );									
					deepEqual( reporter.getDignities( {name:"Jupiter", position:330} ), [astrology.DIGNITIES_RULERSHIP] );
					
					deepEqual( reporter.getDignities( {name:"Jupiter", position:60} ), [astrology.DIGNITIES_DETRIMENT] );
					deepEqual( reporter.getDignities( {name:"Jupiter", position:150} ), [astrology.DIGNITIES_DETRIMENT] );
					
					deepEqual( reporter.getDignities( {name:"Jupiter", position:270} ), [astrology.DIGNITIES_FALL] );					
					
					deepEqual( reporter.getDignities( {name:"Jupiter", position:90} ), [astrology.DIGNITIES_EXALTATION] );										;					
					deepEqual( reporter.getDignities( {name:"Jupiter", position:105}, [{"name":"Jupiter", "position":105, "orbit":2}] ), [astrology.DIGNITIES_EXALTATION, astrology.DIGNITIES_EXACT_EXALTATION] );																																					
				});
				
				test( "dignities - Saturn", function( ) {
					
					var cusps = [0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330];
					var reporter = new astrology.Zodiac( cusps  );	
																	
					deepEqual( reporter.getDignities( {name:"Saturn", position:270} ), [astrology.DIGNITIES_RULERSHIP] );									
					deepEqual( reporter.getDignities( {name:"Saturn", position:300} ), [astrology.DIGNITIES_RULERSHIP] );
					
					deepEqual( reporter.getDignities( {name:"Saturn", position:90} ), [astrology.DIGNITIES_DETRIMENT] );
					deepEqual( reporter.getDignities( {name:"Saturn", position:120} ), [astrology.DIGNITIES_DETRIMENT] );
					
					deepEqual( reporter.getDignities( {name:"Saturn", position:0} ), [astrology.DIGNITIES_FALL] );					
					
					deepEqual( reporter.getDignities( {name:"Saturn", position:180} ), [astrology.DIGNITIES_EXALTATION] );										;					
					deepEqual( reporter.getDignities( {name:"Saturn", position:201}, [{"name":"Saturn", "position":201, "orbit":2}] ), [astrology.DIGNITIES_EXALTATION, astrology.DIGNITIES_EXACT_EXALTATION] );																																					
				});
				
				test( "dignities - Uranus", function( ) {
					
					var cusps = [0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330];
					var reporter = new astrology.Zodiac( cusps  );	
																	
					deepEqual( reporter.getDignities( {name:"Uranus", position:300} ), [astrology.DIGNITIES_RULERSHIP] );
					deepEqual( reporter.getDignities( {name:"Uranus", position:120} ), [astrology.DIGNITIES_DETRIMENT] );
					deepEqual( reporter.getDignities( {name:"Uranus", position:30} ), [astrology.DIGNITIES_FALL] );					
					deepEqual( reporter.getDignities( {name:"Uranus", position:210} ), [astrology.DIGNITIES_EXALTATION] );					
					deepEqual( reporter.getDignities( {name:"Uranus", position:218}, [{"name":"Uranus", "position":218, "orbit":2}] ), [astrology.DIGNITIES_EXALTATION, astrology.DIGNITIES_EXACT_EXALTATION] );																																					
				});
				
				test( "dignities - Neptun", function( ) {
					
					var cusps = [0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330];
					var reporter = new astrology.Zodiac( cusps  );	
																	
					deepEqual( reporter.getDignities( {name:"Neptune", position:330} ), [astrology.DIGNITIES_RULERSHIP] );
					deepEqual( reporter.getDignities( {name:"Neptune", position:150} ), [astrology.DIGNITIES_DETRIMENT] );
					deepEqual( reporter.getDignities( {name:"Neptune", position:60} ), [astrology.DIGNITIES_FALL] );
					deepEqual( reporter.getDignities( {name:"Neptune", position:300} ), [astrology.DIGNITIES_FALL] );
										
					deepEqual( reporter.getDignities( {name:"Neptune", position:120} ), [astrology.DIGNITIES_EXALTATION] );					
					deepEqual( reporter.getDignities( {name:"Neptune", position:240} ), [astrology.DIGNITIES_EXALTATION] );
					deepEqual( reporter.getDignities( {name:"Neptune", position:241}, [{"name":"Neptune", "position":241, "orbit":2}] ), [astrology.DIGNITIES_EXALTATION, astrology.DIGNITIES_EXACT_EXALTATION] );																																					
				});
				
				test( "dignities - Pluto", function( ) {
					
					var cusps = [0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330];
					var reporter = new astrology.Zodiac( cusps  );	
																	
					deepEqual( reporter.getDignities( {name:"Pluto", position:210} ), [astrology.DIGNITIES_RULERSHIP] );
					deepEqual( reporter.getDignities( {name:"Pluto", position:30} ), [astrology.DIGNITIES_DETRIMENT] );					
					deepEqual( reporter.getDignities( {name:"Pluto", position:180} ), [astrology.DIGNITIES_FALL] );																						
					deepEqual( reporter.getDignities( {name:"Pluto", position:0} ), [astrology.DIGNITIES_EXALTATION] );
					deepEqual( reporter.getDignities( {name:"Pluto", position:18}, [{"name":"Pluto", "position":18, "orbit":2}] ), [astrology.DIGNITIES_EXALTATION, astrology.DIGNITIES_EXACT_EXALTATION] );																																					
				});
				
				test( "toDMS", function( ) {					
					var cusps = [0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330];
					var zodiac = new astrology.Zodiac( cusps  );							
					equal( zodiac.toDMS(266.1234), "266° 7' 24" );
					equal( zodiac.toDMS(0.1234), "0° 7' 24" );																																																						
					equal( zodiac.toDMS(360.1234), "360° 7' 24" );
					equal( zodiac.toDMS( 266.3251184363515 ), "266° 19' 30" );									
				});																												
			};// onload
		</script>
	</head>
	<body>
		<h1 id="qunit-header">chart.js tests</h1>
		<h2 id="qunit-banner"></h2>
		<div id="qunit-testrunner-toolbar"></div>
		<h2 id="qunit-userAgent"></h2>
		<ol id="qunit-tests"></ol>
		<div id="qunit-fixture">
			test markup, will be hidden
		</div>
	</body>
</html>